namespace ScrumSprintMonitor.Infrastructure
{
	#region #using Directives

	using System;
	using System.ComponentModel;
	using System.Diagnostics;

	using ContinuousLinq.Reactive;

	#endregion

	public class BurndownDataPoint : ReactiveObject
	{
		static BurndownDataPoint()
		{
			var dependsOn = Register<BurndownDataPoint>();

			dependsOn.Call(me => me.OnPropertyChanged("TotalWork")).OnChanged(me => me.WorkRemaining).OnChanged(me => me.WorkDone);
		}

		private string team;
		private DateTime time;
		private double workDone;
		private double workRemaining;

		public DateTime Time
		{
			[DebuggerStepThrough]
			get { return this.time; }
			set
			{
				if (value == Time)
				{
					return;
				}

				this.time = value;

				OnPropertyChanged("Time");
			}
		}

		public string Team
		{
			[DebuggerStepThrough]
			get { return this.team; }
			set
			{
				if (value == Team)
				{
					return;
				}

				this.team = value;

				OnPropertyChanged("Team");
			}
		}

		public double WorkDone
		{
			[DebuggerStepThrough]
			get { return this.workDone; }
			set
			{
				if (value == WorkDone)
				{
					return;
				}

				this.workDone = value;

				OnPropertyChanged("WorkDone");
			}
		}

		public double WorkRemaining
		{
			[DebuggerStepThrough]
			get { return this.workRemaining; }
			set
			{
				if (value == WorkRemaining)
				{
					return;
				}

				this.workRemaining = value;

				OnPropertyChanged("WorkRemaining");
			}
		}

		public double TotalWork
		{
			[DebuggerStepThrough]
			get { return WorkDone + WorkRemaining; }
		}
	}
}